$(function () {
    //点击返回顶部
    $('.backTop').on('click', function () {
        $('html,body').animate({
            scrollTop: 0
        }, 500)
    })
    // app点击关闭
    $('.app_close').on('click', function () {
        $('.appdownload').animate({
            height: 0,
            padding: 0
        }, 300);
    })

    //模板渲染
    $.ajax({
        type: 'get',
        url: 'http://193.112.55.79:9090/api/getindexmenu',
        datatype: 'json',
        success: function (result) {
            var html = template('nav_tmp', result);
            $('.nav > ul').html(html);
        }
    })

    $.ajax({
        type: 'get',
        url: 'http://193.112.55.79:9090/api/getmoneyctrl',
        datatype: 'json',
        success: function (result) {
            var html = template('products_tmp', result);
            $('.products-list > ul').html(html);
            var liH = $('.nav_list > li').height();
            var minulH = liH * 2;
            console.log(minulH);
            $('.nav_list').height(minulH);
            var ulH = $('.nav_list').height();
            var index = 0;
            $('.nav_list > li').eq(7).on('mousedown',function(){
                var maxulH = liH * 3;
                if(index%2==0){
                    $('.nav_list').animate({height:maxulH},300);
                }else{
                    $('.nav_list').animate({height:minulH},300);
                }
                index++;
            })
        }
    }) 
})